//
//  KTTabsViewController.m
//  BoWuGuan
//
//  Created by 梁尚嘉 on 2016/11/1.
//  Copyright © 2016年 KT. All rights reserved.
//

#import "KTTabsViewController.h"

@interface KTTabsViewController ()

@end

@implementation KTTabsViewController

- (instancetype)init
{
    if (self = [super init]) {
        [self configure];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];

}

- (void)switchToPage:(NSUInteger)pageIndex animated:(BOOL)animated
{
    [self.pagingView moveToPageAtFloatIndex:pageIndex animated:animated];
}


- (void)setControllers:(NSArray<UIViewController *> *)controllers
{
    _controllers = controllers;
    NSMutableArray *titles = [NSMutableArray arrayWithCapacity:controllers.count];
    for (UIViewController *ctrl in _controllers) {
        [titles addObject:ctrl.title];
    }
    self.menuTitles = titles;

}

#pragma mark - Override Methods

- (UIView *)contentViewForPage:(ZWSPage *)page atIndex:(NSInteger)index
{
    // subclass could override
    return [self.controllers[index] view];
}

#pragma mark - ZWSPagingViewDelegate
- (void)pagingView:(ZWSPagingView *)pagingView didMoveToPage:(ZWSPage *)page {
    self.selectedIndex = pagingView.floatIndex; 
}


- (void)configure
{
    self.sectionBar.textColor = SM_darkGrayColor;
    self.sectionBar.nomarlTextFont = SM_CFont(30);

    self.sectionBar.highlightedTextColor = SM_thumeColor;
    self.sectionBar.selectedTextFont = SM_CFont(30);
    self.sectionBar.backgroundColor = SM_whiteColor;

    self.sectionBar.bottomLineColor = SM_lightGrayColor;
}


- (void)dealloc
{
    NSLog(@"%@",NSStringFromClass(self.class));
}



@end
